<?php

include_once 'connection/connection_database.php';

class Questions {
    function Insert($question){
        $date = date("Y-m-d H:i:s");
        $sql = "INSERT INTO question(question_title, fullname, phone, email, question_description, question_datetime) VALUES('{$question["question_title"]}', '{$question["username"]}', '{$question["phone"]}', '{$question["email"]}', '{$question["description"]}', '{$date}')";
        return mysql_query($sql) or die(mysql_error());
    }
    
    function FillAll(){
        $sql = "SELECT * FROM question";
        $result = mysql_query($sql) or die(mysql_error());
        return $result;
    }
    
    function FillOne($question_id){
        $sql = "SELECT * FROM question q, users u WHERE q.user_id=u.user_id and question_id={$question_id}";
        $result = mysql_query($sql) or die(mysql_error());
        return $result;
    }
}

?>
